 0 TABLE OF CONTENTS
---------------------

1. SPELL CHARGES
2. LEVELUPS
3. SPELLS
4. ITEMS
5. TEXT DISPLAY AND DATA
6. THE BESTIARY
7. MISCELLANEOUS

---Note---
This document mainly pertains to aspects of FF1a modified by the Vancian magic patch, and does not
go in-depth on data structures in FF1a. For more detailed information on things like the spell data
format, class base stats data, and general routines, look to RHDN's Data Crystal or my own FF1a
notes, also hosted on RHDN.


 1. SPELL CHARGES
------------------
*MP has been replaced with spell charges. As you might imagine, almost all code that reads or writes
MP will instead work with spell charges instead.
*The memory addresses which held MP values are now unused; to my knowledge they are not written to
or read from outside of New Game handling and some now-unused routines.

*A character's spell charge data is located in the same region of memory as character data and the
Bestiary. Specifically, after loading the pointer contained in 0x02000584, spell charge data begins
after 0xC78 bytes.
	-As with other PC data, this data will move around properly when the Formation command is used
	to swap character positions.
*Each character has sixteen bytes reserved; the first eight correspond to their current spell charges
in each level, while the other eight hold the maximum spell charges per level.

*A new routine at 0xF11080 has been added to make accessing this data easier.
	-To use it, set r0 to the character ID to load data for, and r1 to the spell level to use.
	The routine will return an offset in spell charge data based on those parameters.
	-Of course, you can set r0 to 0 and r1 to 1 to access the base offset of spell charge data.

*A class may begin the game with spell charges in Level 1. This data is defined in the class's base
stats data (table at 0x1E1354), where starting MP used to be defined. By default, Red/White/Black
Mages begin with two charges.

*As a character statistic, Magic Level has been abolished as redundant. A caster may purchase and
use any spell that they have charges of the appropriate level for which their class has access to.
*Consequently, the byte in character data which held this value is now unused.

*The maximum amounts of spell charges a class may possess in each of the eight spell levels are
defined in a table at 0xF125B0. Each class has eight bytes, one for each spell level. There are
twelve entries in the table, one for each class, in the usual order:
	-Warrior
	-Thief
	-Monk
	-Red Mage
	-White Mage
	-Black Mage
	-Knight
	-Ninja
	-Master
	-Red Wizard
	-White Wizard
	-Black Wizard
*Beyond and above these class-based caps, however, exists a global cap of 99 spell charges in a single
spell level. This is mainly for display reasons.


 2. LEVELUPS
-------------

*A character gains spell charges on levelup according to a lookup table located at $F12100.
Each class has 98 bytes, one for each level from 2-99.
*In these bytes, each bit represents a spell level; the lowest bit for SL 1, the highest for SL8,
and so on.
*By default, the level pattern is identical to the NES version; that means spell charges cease
to increase after Level 50 (except for the Knight and Ninja).

 3. SPELLS
-----------

*As in vanilla, the spell data table is located at 0x1A1980, with each spell taking up sixteen bytes:
 +$0: Usage (Battle/Field/Both)
 +$1: Targeting
 +$2-3: Power/Status Type/etc
 +$4-5: Element(s)
 +$6: Spell Type
 +$7: Graphics Index
 +$8: Accuracy
 +$9: Spell Level
 +$A-B: (unused - formerly MP cost)
 +$C-F: Purchase Price

*Instead of individual MP costs, all spells consume one spell charge from their corresponding level.
A Level 1 spell like Blink will consume a Level 1 charge, a L8 spell like Flare uses L8 charges, etc.

*In the unmodified game, a spell's level sometimes determined using its spell ID only. Now, a spell's
level is defined by a dedicated byte in its data, as indicated above. This makes it much easier to
change a spell's properties without having to physically reorder a spell in the ROM.
	-Note that without the addon patch for making monsters use a spell's Graphics Index, monster
	spells will use animations based on the spell's ID instead.
	-Note also that there still exists hardcoding for Exit and Teleport's spell IDs in spell
	usability routines.
	

*The spells used by Ethers, Elixirs and their variants have had their formulas modified to account for
the Vancian system; more on them in the Items section.

 4. ITEMS
----------

*Tents, Cottages, Inns and other sourcesof field-based MP healing have been reworked.
	-As in vanilla, a small table at $212B8A controls how much these sources restore:
	+$00: Inn
	+$02: Cottage
	+$04: Tent
	+$06: Sleeping Bag
	-However, with this patch, the values represent how many eights of each spell level that source
	will restore; so a value of 8 or above means all spell charges will be refilled.

*Other MP-restoring items - Ethers, Elixirs and their variants - restore spell charges in their own
way, in and out of battle. The power byte of the item (or of their inbattle spell version) will
restore spell charges like this:
	-The first spell level will be restored by the unmodified power.
	-Subsequent spell levels will be restored according to this formula:
		-Amount restored = Power - ((([SLvl-1]+[Slvl-1]/2)+1)*Power)/16
		-The upshot of this formula is that the charges restored goes down by an average
		of 3/32 per spell level, with Level 8 being restored by roughly a third of the power value.
*Ethers and Turbo Ethers have had their powers changed to fit in with this new system, and their
description texts have been updated to reflect these changes. See Source/Misc Data.txt for more info.

*Soma Drops will increas a character's maximum charges by the item Power for each level, but not
beyond their class's cap for charges or 99, whichever is lower.

*Faerie Tonics, which used to temporarily increase maximum MP in battle, do nothing now. The
old formulas have not been edited, but the Faerie tonic may not be used in any circumstance;
its description has also been replaced with "DUMMY".
	-Specifically, the item is no longer associated with the Faerie Tonic spell in battle;
	this spell has also been edited to use the blank formula.
	
*The MP boost byte for weapons and armor does nothing and so is unused.
	
 5. TEXT DISPLAY AND DATA
--------------------------

*All areas that display MP, and thus the routines behind them, have been redone to print spell
charge data instead. Spell charges are still called "MP" in game, however.
*For space reasons, a character's maximum spell charges per level are only visible in the Magic
menus in battle or in the field. In other menus such as the Status menu, only the current charges
for each spell level are displayed.
*New text data (for "Magic Level" and a few item descriptions) is located at 0xF12000.
*In battle, the main window no longer shows MP data; instead HP values are printed farther to the
right. An enterprising hacker could take advantage of this and unused bytes in character data to
expand name lengths for PCs...

 6. THE BESTIARY
-----------------
*In order to make space for spell charge data, Bestiary data in memory was restructured slightly.
Normally, each monster owns two bytes; the top bit tracks whether their Bestiary entry has been
viewed before, and the other bits count the number of that monster species you've slain, up to 999.
*Now, each monster owns just one bit, and only counts slayings up to 99 individuals. This should
still be plenty for normal playthroughs.

*The Bestiary data had several advantages to recommend it: the data is all contiguous, easy to
downsize, simple to locate in memory, and undergoes no compression or bitpacking when being stored
to SRAM.

 7. MISCELLANEOUS
------------------
*The code that prepares a save file and WRAM for a New Game was rewritten so that spell charge
data is properly wiped on a New Game Plus.

*In unmodified FF1a, the Rune Axe will consume 25 MP when attacking in exchange for always hitting
and scoring critical strikes on each hit. It no longer has any special properties.